package com.qc.searchBug.services;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qc.searchBug.dao.UserInfoMapper;
import com.qc.searchBug.pojo.UserInfo;
import com.qc.searchBug.util.MD5;
@Service
public class UserInfoServicesImpl implements UserInfoServices{
	@Autowired
	private UserInfoMapper userInfoMapper;
	/**
	 * 用户登录
	 */
	@Override
	public UserInfo findUserLogin(String phone, String pwd) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("username", phone);
		map.put("pwd", MD5.getMD5(pwd));
		return userInfoMapper.findUserLogin(map);
	}
	/**
	 * 用户注册
	 */
	@Override
	public int userRegisterServices(Map<String, Object> map) {
		return userInfoMapper.addUserInfoMapper(map);
	}
	/**
	 * 根据手机验证码修改密码
	 */
	@Override
	public int updatePwdByPhoneCode(String password,int userId) {
		Map<String,Object> map= new HashMap<String, Object>();
		map.put("password", MD5.getMD5(password));
		map.put("userId", userId);
		return userInfoMapper.updatePwdByPhoneCode(map);
	}

}
